package com.itheima.myreflect2.Student.threaddemo16;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @program: Myset
 * @description:
 * @author: xuejingjing
 * @create: 2021-06-19 17:04
 **/
public class threaddemo16 {
    public static void main(String[] args) throws InterruptedException {
        //阻塞队列的基本用法
        //创建阻塞队列的对象，容量为1
        ArrayBlockingQueue<String> arrayBlockingQueue = new
                ArrayBlockingQueue<String>(1);

        //存储元素
        arrayBlockingQueue.put("汉堡包");

        //去元素
        System.out.println(arrayBlockingQueue.take());
        System.out.println(arrayBlockingQueue.take());
        System.out.println("程序结束了...");
    }
}
